
PROCEDURE getRunTime:
	define input parameter phase as character.
	define output parameter tme like hwot__dec02 format "->>>>>>>>>>>>>>9.9<<<<<<<<<".
/*     tme = ((2400 + (dec(substr(phase,5,2)) * 60 - dec(substr(phase,1,2)) * 60 +                   */
/*                      dec(substr(phase,7,2)) - dec(substr(phase,3,2))) / 0.6) modulo 2400) / 100 . */

    if substring(phase,5,4) > substring(phase,1,4) then do:
        tme = ((dec(substring(phase,5,2)) * 60 + dec(substring(phase,7,2)) ) - (dec(substring(phase,1,2)) * 60 + dec(substring(phase,3,2)))) / 60.
    end.
    else do:
        tme = (((dec(substring(phase,5,2)) + 24) * 60 + dec(substring(phase,7,2)) ) - (dec(substring(phase,1,2)) * 60 + dec(substring(phase,3,2)))) / 60.
    end.
 	
END PROCEDURE.

procedure getTime :
    define input parameter w1 as character.
    define input parameter w2 as character.
    define input parameter t1 as character.
    define input parameter t2 as character.
    define output parameter tme like hwot__dec02 format "->>>>>>>>>>>>>>9.9<<<<<<<<<".

    define variable phase as character.

    if w1 >= t1 and W1 < T2 then do:
        if w2>= t2 then do:
            phase = w1 + T2.
        end.
        else do:
            phase = w1 + w2.
        end.
    end.
    else if t1 < w2  and w1 < T2 then do:
        if W2 >= t2  then do:
            phase = t1 + t2.
        end.
        else do:
            phase = t1 + W2.
        end.
    end.
    else do:
        phase = "00000000".
    end.
/*     tme = ((2400 + (dec(substr(phase,5,2)) * 60 - dec(substr(phase,1,2)) * 60 +                   */
/*                      dec(substr(phase,7,2)) - dec(substr(phase,3,2))) / 0.6) modulo 2400) / 100 . */

/*     message phase tme view-as alert-box.  */
    if substring(phase,5,4) > substring(phase,1,4) then do:
        tme = ((dec(substring(phase,5,2)) * 60 + dec(substring(phase,7,2)) ) - (dec(substring(phase,1,2)) * 60 + dec(substring(phase,3,2)))) / 60.
    end.
    else if substring(phase,5,4) < substring(phase,1,4) then do:
        tme = (((dec(substring(phase,5,2)) + 24) * 60 + dec(substring(phase,7,2)) ) - (dec(substring(phase,1,2)) * 60 + dec(substring(phase,3,2)))) / 60.
    end.
    
/*     tme = ((dec(substring(phase,5,2)) * 60 + dec(substring(phase,7,2)) ) - (dec(substring(phase,1,2)) * 60 + dec(substring(phase,3,2)))) / 60. */
end procedure.

/* define variable ts as decimal.                                                       */
/*   run gettime (input "0800", input "1100", input "1100", input "1145", output ts)  . */

